#include "subs.h"

/*
Direction Type Address        Text              
--------- ---- -------        ----              
Up        p    sub_EA2580+11  call    sub_F0828D
Up        p    sub_EA27C0+281 call    sub_F0828D
Up        p    sub_EA7200+21  call    sub_F0828D
Up        p    sub_EA7910+97  call    sub_F0828D
Up        p    sub_EBDC40+15D call    sub_F0828D
Up        p    sub_EBE7A0+62  call    sub_F0828D
Up        p    sub_EBE830+33  call    sub_F0828D
Up        p    sub_EBE890+17  call    sub_F0828D
Up        p    sub_EBEBA0+39  call    sub_F0828D
Up        p    sub_EBF350+B0  call    sub_F0828D
Up        p    sub_ECD860+10A call    sub_F0828D
Up        p    sub_ECD860+30A call    sub_F0828D
Up        p    sub_ECDDA0+D2  call    sub_F0828D
*/

int sub0006828D ( LPCWSTR lpFileName )
{	
	/* TODO:
		Detour Those
	*/
	int ( *sub00068F5C ) ( int a1 ) = ( int ( __cdecl* ) ( int ) )( __BaseAddress + 0x68F5C );

	log ( "[sub0006828D] Detour." );

	char l_FileName[ MAX_PATH ] = { 0 };
	wcstombs ( l_FileName, lpFileName, MAX_PATH );

	log ( "[sub0006828D] \tlpFileName %s", l_FileName );

	int l_Result = 0;

	if ( DeleteFileW ( lpFileName ) )
	{
		l_Result = 0;
	}
	else
	{
		l_Result = GetLastError();
	}
	
	if ( l_Result )
	{
		sub00068F5C ( l_Result );
	}
  
	return l_Result;
}